<?php

namespace apiend\modules\user\controllers;

use Yii;
use apiend\components\Controller;
use apiend\modules\user\models\AccountLogSearch;
use yii\helpers\ArrayHelper;

/**
 * 用户商城交易积分收支记录
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class CreditController extends Controller {

    /**
     * 默认接口
     * @inheritdoc
     */
    public function actionIndex() {
        $userId = Yii::$app->request->get('user_id');
        $model = new AccountLogSearch($userId);
        return $model->configs();
    }

    /**
     * 检索接口
     * @inheritdoc
     */
    public function actionList() {
        $params = Yii::$app->request->getQueryParams();
        $userId = ArrayHelper::getValue($params, 'user_id');
        $model = new AccountLogSearch($userId);
        $model->load($params, '');
        return $model->search();
    }

}
